home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boot Disc 5
/
boot-disc-1997-01.iso
/
media
/
utility.cst
/
00028_Script_Scripting Utilities
< prev
next >
Wrap
Text File
|
1996-11-05
|
4KB
|
129 lines
on document myscript
set q=quote
set rt=return
set buffer=rt
if the number of member myscript<1 then
alert "An attempt was made to document a non-existent script."
exit
else
if the type of member myscript<>#script then
alert "An attempt was made to document a non-script object."
exit
end if
end if
set curtext=the scripttext of member myscript
set startline=0
set endline=0
repeat with index=1 to the number of lines in curtext
if line index of curtext="on help me" then
set startline=index
end if
if line index of curtext="end help" then
set endline=index
end if
end repeat
if startline>0 then
delete line startline to endline of curtext
end if
set olddelimiter=the itemdelimiter
set the itemdelimiter=quote
repeat with index=1 to the number of lines in curtext
set curline=line index of curtext
if offset("--#",curline) then
set newstr=(char 4 to length(curline) of curline)
set itemlist=[]
repeat with curitem=1 to the number of items in curline
add itemlist,item curitem of newstr
end repeat
set midbuffer=""
repeat with curitem=1 to count(itemlist)
if curitem<count(itemlist) then
set midbuffer=midbuffer&(getat(itemlist,curitem))&q&""e&"&q
else
set midbuffer=midbuffer&(getat(itemlist,curitem))
end if
end repeat
set buffer=buffer&" put "&q&midbuffer&q&rt
end if
end repeat
set curtext=curtext&rt&rt&"on help me"&rt
set curtext=curtext&buffer
set curtext=curtext&"end help"
set the scripttext of member myscript to curtext
set the itemdelimiter=olddelimiter
put q&myscript&q&"script successful processed."
end
on man myscript,commentflag
set buffer=""
set curtext=the scripttext of member myscript
repeat with index=1 to the number of lines in curtext
set curline=line index of curtext
set word1=word 1 of curline
case word1 of
"on","property":
put curline
"--#":
if commentflag then
put "*"&(char 4 to length(curline) of curline)
end if
end case
end repeat
end
on default defvalue,passedvalue
if voidP(passedvalue) then
set curval=defvalue
else
set curval=passedvalue
end if
return curval
end
on echoname srcstart,srcend,targetstart
repeat with index=srcstart to srcend
set newcast=targetstart+index-srcstart
set the name of member newcast to the name of member index
end repeat
end
on getdrive
set curpath=the moviepath
set olddelimiter=the itemdelimiter
set the itemdelimiter="\"
set drive=(item 1 of curpath)&"\"
set the itemdelimiter=olddelimiter
return drive
end
on querybrowser
global gbrowser
if the platform="Windows,32" then
set browserlist=["Progra~1\Netscape\Naviga~1\Program\Netscape.exe","progra~1\Micros~1\iexplore.exe"]
else
set browserlist=["netscape\naviga~1\netscape.exe"]
end if
openxlib getdrive()&"misc_x.dll"
set obj=misc_x(mNew)
set browserfound=false
repeat with browser in browserlist
if obj(mFileExists,"c:\"&browser)=1 then
set browserfound=true
set gbrowser="c:\"&browser
exit repeat
end if
end repeat
if not browserfound then
if gbrowser<>#none then
set status=obj(mAsk, "Can't find a browser. Can you help me?","c:\","Okay","Cancel")
if status<>"Don't select browser right now." then
set gbrowser=status
else
set gbrowser=#none
end if
end if
end if
obj(mDispose)
return gbrowser
end